package com.reebake.ideal.response.wrapper.config;

import com.reebake.ideal.response.wrapper.core.DefaultResponseBodyWrapper;
import com.reebake.ideal.response.wrapper.properties.ResponseBodyWrapperProperties;
import com.reebake.ideal.servlet.core.ResponseBodyWrapper;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@EnableConfigurationProperties({ResponseBodyWrapperProperties.class})
@Import({GlobalResponseBodyWrapper.class})
public class ResponseWrapperAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    ResponseBodyWrapper restResultFormatter() {
        return new DefaultResponseBodyWrapper();
    }

}
